package com.csscis.ssm.web.service.impl;

import com.csscis.ssm.core.generic.GenericDao;
import com.csscis.ssm.core.generic.GenericServiceImpl;
import com.csscis.ssm.web.dao.MessageTableMapper;
import com.csscis.ssm.web.model.MessageTable;
import com.csscis.ssm.web.service.MessageTableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import java.util.UUID;

@Service
public class MessageTableServiceImpl extends GenericServiceImpl<MessageTable, Long> implements MessageTableService {
    @Autowired
    private MessageTableMapper messageTableMapper;

    @Override
    public GenericDao<MessageTable, Long> getDao() {
        return messageTableMapper;
    }
    @Override
    public int insert(MessageTable messageTable, HttpServletRequest request) {
        messageTable.setMessageId(UUID.randomUUID().toString());
        return super.insert(messageTable);
    }
}
